<!DOCTYPE html>
<html lang="zh-CN" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="layout/default" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>审计记录</title>
    <script th:src="@{/assets/scripts/export.js}"></script>
    <script th:src="@{/assets/scripts/form-components.js}"></script>
    <link th:href="@{/assets/css/logs.css}" rel="stylesheet"/>
    <!--[if lt IE 10]>
    <link th:href="@{/assets/css/ie.css}" rel="stylesheet" type="text/css"/>
    <![endif]-->
    <script>
        $(document).ready(function () {
            Export.initExpWindow();
            Export.selectDataByKey();
            FormComponents.init();
        });

        //分页
        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            if (n == null || n == "") {
                $(".real-key").val($(".show-key").val());
            }
            $("#logsSearchForm").submit();
            return false;
        }
    </script>
</head>
<body>
<div layout:fragment="content" th:remove="tag">
    <input type="hidden" id="basePath" th:value="@{/sys/log/checkDate}">

    <div th:replace="fragments/tool :: tipMessage (type='',content=${message})" th:remove="tag"></div>
    <div class="row">
        <div class="col-md-12">
            <!-- BEGIN PAGE TITLE & BREADCRUMB-->
            <ul class="page-breadcrumb breadcrumb">
                <li>
                    <i class="fa fa-home"></i>
                    <a th:href="@{/}">首页</a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li><a href="#">审计记录</a></li>
            </ul>
            <!-- END PAGE TITLE & BREADCRUMB-->
        </div>
    </div>

    <div class="row profile">
        <div class="col-md-12">
            <!--BEGIN TABS-->
            <div class="tabbable tabbable-custom tabbable-full-width">
                <div class="tab-content">
                    <div class="tab-pane active" id="user_tab_1_1">
                        <div class="row search-form-default alert alert-info">
                            <form id="logsSearchForm" th:object="${logs}"
                                  th:action="@{/sys/log}" method="post"
                                  class="form-inline">
                                <input id="pageNo" name="pageNo" type="hidden" th:value="${logs.pageNo}"/>
                                <input id="pageSize" name="pageSize" type="hidden" th:value="${logs.pageSize}"/>
                                <input id="orderBy" name="orderBy" type="hidden" th:value="${logs.orderBy}"/>

                                <div class="col-md-12">
                                    <div class="input-group input-xlarge key-exp-clean">
                                        <!-- /btn-group -->
                                        <input type="text" th:value="${keyWord}" class="form-control show-key"
                                               maxlength="50" placeholder="如：操作员 | 系统名称..." shiro:has-permission="sys:log:view"/>
                                        <input type="hidden" class="form-control real-key"
                                               th:value="${keyWord}" name="keyWord" maxlength="50"/>
                                        <div class="input-group-btn">
                                            <button type="button" class="btn green" id="searchBt" onclick="return page();" shiro:has-permission="sys:log:view">
                                                搜索 &nbsp;<i class="m-icon-swapright m-icon-white"></i>
                                            </button>
                                            &nbsp;&nbsp;&nbsp;
                                            <a data-toggle="modal" href="#basicExp" shiro:has-permission="sys:log:export">
                                                <button type="button" class="btn blue">
                                                    导出
                                                </button>
                                            </a> &nbsp;&nbsp;&nbsp;
                                            <a th:href="@{/sys/log/clear}" shiro:has-permission="sys:log:delete"
                                               onclick="return App.confirm('清空记录前请导出备份，确认清空审计记录信息？', this.href)">
                                                <button type="button" class="btn green" onclick="">
                                                    清空
                                                </button>
                                            </a>
                                        </div>
                                        <!-- /btn-group -->
                                    </div>
                                </div>
                            </form>
                        </div>

                        <div class="table-responsive">
                            <table class="table table-striped table-bordered table-advance table-hover table-ie">
                                <thead>
                                <tr>
                                    <th class="td-minw-1 th-ie">序列</th>
                                    <th class="td-minw-2">日志类型</th>
                                    <th class="td-minw-3">日志名称</th>
                                    <th class="td-minw-4">系统名称</th>
                                    <th class="td-minw-5">操作员</th>
                                    <th class="td-minw-6">机构名称</th>
                                    <th class="td-minw-7">操作IP</th>
                                    <th class="td-minw-8" width="180px">操作时间</th>
                                    <th class="td-minw-9">事件结果</th>
                                    <th class="td-minw-10">日志描述</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:each="logInfo , stat : ${logs.list}">
                                    <td th:text="(${logs.pageNo} - 1) * ${logs.pageSize} + 1 + ${stat.index}">1</td>
                                    <td th:text="${logInfo.type}">勾选系统</td>
                                    <td th:text="${logInfo.name}">添加权限</td>
                                    <td th:text="${logInfo.system}" th:title="${logInfo.system}"
                                        class="text-leave-out max-real-name">权限系统</td>
                                    <td th:text="${logInfo.loginName}" th:title="${logInfo.loginName}"
                                        class="text-leave-out max-real-name">
                                        192.168.30.1
                                    </td>
                                    <td th:text="${logInfo.orgName}" th:title="${logInfo.orgName}"
                                        class="text-leave-out max-real-name">admin</td>
                                    <td th:text="${logInfo.ip}">2016-9-14 11:32:20</td>
                                    <td th:text="${#dates.format(logInfo.createDate, 'yyyy-MM-dd HH:mm:ss')}">成功</td>
                                    <td th:text="${logInfo.result}">成功</td>
                                    <td th:text="${logInfo.description}"
                                        th:title="${logInfo.description}"
                                        class="text-leave-out max-real-name">
                                        admin添加权限
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="row margin-top-20">
                            <th:block th:utext="${logs}"/>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <form id="exportForm" th:action="@{/sys/log/export}" method="post"
          class="form-inline">
        <div class="modal fade export" id="basicExp" tabindex="-1" role="basic"
             aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header new-style">
                        <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true"></button>
                        <div class="exp-div-margin">
                            <img th:src='@{/assets/img/custom/export_img.png}' class="export-icon">

                            <p class="export-click exp-header">
                                数据导出
                            </p>
                        </div>
                    </div>
                    <div class="modal-body exp-div-font">
                        <ul class="time-ul-p">
                            <li>请选择导出数据的时间范围</li>
                        </ul>
                        <div class="form-group row begin-text">
                            <label class="col-md-5">开始时间：</label>

                            <div class="col-md-7">
                                <div class="input-group input-small date date-picker" data-date-format="yyyy-mm-dd"
                                     data-date-viewmode="years">
                                    <input type="text" class="form-control" name="startTime" id="startTime"
                                           placeholder="请选择" onchange="Export.changeTime()"
                                           onkeyup="Export.changeTime()"/>
								<span class="input-group-btn">
								<button class="btn default" type="button"><i class="fa fa-calendar"></i></button>
								</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row end-text">
                            <label class="control-label col-md-5">结束时间：</label>

                            <div class="col-md-7">
                                <div class="input-group input-small  date date-picker" data-date-format="yyyy-mm-dd"
                                     data-date-viewmode="years">
                                    <input type="text" class="form-control" name="endTime" id="endTime"
                                           placeholder="请选择" onchange="Export.changeTime()"
                                           onkeyup="Export.changeTime()"/>
								<span class="input-group-btn">
									<button class="btn default" type="button"><i class="fa fa-calendar"></i></button>
								</span>
                                </div>
                            </div>
                        </div>
                        <p class="error_info_mg" id="errorMessage"></p>
                    </div>
                    <div class="modal-footer export_btn">
                        <button type="button" class="btn" id="expBt">数据导出</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
    </form>
</div>
</body>
</html>
